/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package Main;
import Model.DrinkSpec;
import java.util.ArrayList;
import java.sql.*;
import Dao.DatabaseConnect;

import javax.swing.JOptionPane;

public class DrinkCatalog{
    
    //private DrinkSpec[] drinkList;
    
    Connection conn = null;
    ResultSet rs = null;
    PreparedStatement pst = null;
    
    ArrayList<DrinkSpec> drinks=new ArrayList<DrinkSpec>();
    
    public DrinkCatalog(DrinkSpec[] drinks){
        
        
        //ArrayList<DrinkSpec> drinks=new ArrayList<DrinkSpec>();
        conn=DatabaseConnect.ConnectDb();
        //this.drinkList = drinkList;
        
        
    }
    

    private void fillCatalog(){
        try{
            
            String sql = "select * from Drinks";
            
            pst = conn.prepareStatement(sql);
            rs = pst.executeQuery();
            
            while(rs.next()){
                
                String DrinkName = rs.getString("DrinkName");
                int DrinkID = rs.getInt("DrinkID");
                String DrinkDesc = rs.getString("DrinkDesc");
                int DrinkPrice = rs.getInt("DrinkPrice");
                
                
                DrinkSpec temp = new DrinkSpec(DrinkName,DrinkID,DrinkDesc,DrinkPrice);
                
                this.drinks.add(temp);
                
                System.out.println(temp);
                
                
                
            }
            
        }
        catch(Exception e){
            JOptionPane.showMessageDialog(null, e);
        }
    }
    
 //   
    
    
    
}
    
    
    
    
    
/*
    
    public DrinkSpec[] getDrinkList() {
        return drinkList;
    }

   
    public void setDrinkList(DrinkSpec[] drinkList) {
        this.drinkList = drinkList;
    }
    
    
   */
    

